package com.jxl.wechat.handler;

/**
 * 微信消息推送的MsgType枚举
 */
public enum WeChatMsgTypeEnums {

    TEXT("text","用户发送的文本数据"),
    SUBSCRIBE("event.subscribe","用户关注事件");

    private String msgType;

    private String dec;

    WeChatMsgTypeEnums(String msgType, String dec) {
        this.msgType = msgType;
        this.dec = dec;
    }

    /**
     * 根据类型获取枚举
     * @param msgType
     * @return
     */
    public static WeChatMsgTypeEnums getByMsgType(String msgType){
        WeChatMsgTypeEnums[] values = WeChatMsgTypeEnums.values();
        for (WeChatMsgTypeEnums weChatMsgTypeEnums:values) {
            if (weChatMsgTypeEnums.msgType.equals(msgType)){
                return weChatMsgTypeEnums;
            }
        }
        return null;
    }
}
